<?php
namespace app\portal\controller;
use think\Db;
use cmf\controller\HomeBaseController;

class IndexController extends HomeBaseController
{
    public function index()
    {

    	$posts = Db::view('dy_portal_post','*')
		->view('dy_portal_category_post','*','dy_portal_category_post.post_id=dy_portal_post.id')
		->where('dy_portal_category_post.category_id','in','2,8,9,10,11,12,13,15,16')
		->select();

		$item=array();
        foreach($posts as $k=>$v){
			    if(!isset($item[$v['category_id']])){
			        $item[$v['category_id']][]=$v;
			    }else{
			        $item[$v['category_id']][]=$v;
			    }
			}

	$this->assign([
		'case' => isset($item[2]) ? $item[2] : null,
		'fw1' => isset($item[12]) ? $item[12] : null,
		'fw2' => isset($item[13]) ? $item[13] : null,
		'gsxw' => isset($item[8]) ? $item[8] : null,
		'hydt' => isset($item[9]) ? $item[9] : null,
		'bxzs' => isset($item[10]) ? $item[10] : null,
		'cjwt' => isset($item[11]) ? $item[11] : null,
		'Certificate' => isset($item[15]) ? $item[15] : null,
		'Customers' => isset($item[16]) ? $item[16] : null,
	]);


        return $this->fetch(':index');
    }
}
